#lang r5rs
(define (repeat f n)  
  (lambda (x)
    (begin
      (define (repeat-iter f n)
        (if (= n 1)
          (f x)
          (f (repeat-iter f (- n 1)))))
      (repeat-iter f n))))
(define (square x) (* x x))
(display ((repeat square 2) 5))
